import { defineConfig } from 'vite'
import path from 'path'
import vue from '@vitejs/plugin-vue'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src') // 👈 根目录 配置别名
    }
  },
  server: {
    proxy: {
      // 代理匹配 /admin/api 路径到后台服务器
      '/admin/api': {
        target: 'http://localhost:8080',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/admin\/api/, '/api')
      }
    }
    
  }
})
